<?php

//<editor-fold defaultstate="collapsed" desc="License & Copyright">
/*
 * @license
 */

/**
 *
 * @author Jevgeni Geimanen (jevgeni.geimanen@gmail.com)
 */
//</editor-fold>
/**
 * @default-page   
 */
class HelloWorldPage extends CMSPage {

    /**
     *
     * @var HelloWorldForm
     */
    private $_HelloWorldForm;

    /**
     * 
     * @return HelloWorldForm
     */
    public function getHelloWorldForm() {
        if ($this->_HelloWorldForm === null) {
            $this->_HelloWorldForm = $this->AddChildControl(new HelloWorldForm());
            $this->_HelloWorldForm->addSubmitEventListener($this, 'HelloWorldForm_OnSubmit');
        }
        return $this->_HelloWorldForm;
    }

    public function Create() {
        $this->getHelloWorldForm();
        return parent::Create();
    }

    //<editor-fold defaultstate="collapsed" desc="Event Handlers">
    public function HelloWorldForm_OnSubmit($event) {
        $this->getHelloWorldForm()->getFields()->getText()->setValue("Hello world!")->AjaxRender();
    }

    //</editor-fold>
}

?>
